<template>
  <div class="aui-wrapper aui-page__login">
    <div class="logo">
      <img width="200px" src="~@/assets/img/logo.png" />
    </div>
    <div class="aui-content__wrapper">
      <main class="aui-content">
        <div class="login-header">
          <h2 class="login-brand">方信知识产权报价系统</h2>
        </div>
        <div class="login-body panel-lite">
          <div class="thumbur">
            <div class="icon-lock"></div>
          </div>

          <h3 class="login-title">用户登录</h3>

          <el-form
            :model="dataForm"
            :rules="dataRule"
            ref="dataForm"
            @keyup.enter.native="dataFormSubmitHandle()"
            status-icon
          >
            <el-form-item prop="username">
              <el-input v-model="dataForm.username" placeholder="邮箱">
                <span slot="prefix" class="el-input__icon">
                  <svg class="icon-svg" aria-hidden="true">
                    <use xlink:href="#icon-user" />
                  </svg>
                </span>
              </el-input>
            </el-form-item>
            <el-form-item prop="password">
              <el-input v-model="dataForm.password" type="password" placeholder="验证码">
                <span slot="prefix" class="el-input__icon">
                  <svg class="icon-svg" aria-hidden="true">
                    <use xlink:href="#icon-lock" />
                  </svg>
                </span>

                <span slot="suffix" class="el-input__icon">
                  <span class="el-input__code">发送验证码</span>
                </span>

              </el-input>

            </el-form-item>
            <el-form-item>
              <el-button
                type="primary"
                @click="dataFormSubmitHandle()"
                class="w-percent-100"
              >{{ $t('login.title') }}</el-button>
            </el-form-item>
          </el-form>
        </div>
      </main>
    </div>
  </div>
</template>

<script>
import debounce from "lodash/debounce";
import { messages } from "@/i18n";
import { getUUID } from "@/utils";
export default {
  data() {
    return {
      i18nMessages: messages,
      dataForm: {
        username: "",
        password: ""
      }
    };
  },
  computed: {
    dataRule() {
      return {
        username: [
          {
            required: true,
            message: this.$t("validate.required"),
            trigger: "blur"
          }
        ],
        password: [
          {
            required: true,
            message: this.$t("validate.required"),
            trigger: "blur"
          }
        ]
      };
    }
  },
  created() {},
  methods: {
    // 表单提交
    dataFormSubmitHandle: debounce(
      function() {
        this.$router.push({ name: "index" });
      },
      1000,
      { leading: true, trailing: false }
    )
  }
};
</script>

<style lang="scss" scoped>
.logo {
  width: 200px;
  height: 100px;
}
.panel-lite {
  margin: 20px auto;
  max-width: 460px;
  background: #fff;
  padding: 45px 20px;
  border-radius: 4px;
  box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.2);
  position: relative;
}
.thumbur {
  width: 150px;
  height: 150px;
  position: relative;
  background-color: #efefef;
  *zoom: 1;
  filter: progid:DXImageTransform.Microsoft.gradient(gradientType=1, startColorstr='#FFEFEFEF', endColorstr='#FFE1E1E1');
  background-image: url();
  background-size: 100%;
  background-image: -webkit-gradient(
    linear,
    0% 50%,
    100% 50%,
    color-stop(0%, #efefef),
    color-stop(50%, #efefef),
    color-stop(50%, #e1e1e1),
    color-stop(100%, #e1e1e1)
  );
  background-image: -webkit-linear-gradient(
    left,
    #efefef 0%,
    #efefef 50%,
    #e1e1e1 50%,
    #e1e1e1 100%
  );
  background-image: linear-gradient(
    to right,
    #efefef 0%,
    #efefef 50%,
    #e1e1e1 50%,
    #e1e1e1 100%
  );
  margin: auto;
  border-radius: 100%;
}

.thumbur:before {
  content: "";
  position: absolute;
  width: 6px;
  height: 12px;
  background-color: #efefef;
  left: 50%;
  bottom: 50px;
  z-index: 5;
  -ms-transform: translateX(-50%);
  -webkit-transform: translateX(-50%);
  transform: translateX(-50%);
  border-bottom-left-radius: 2px;
  border-bottom-right-radius: 2px;
}

.icon-lock {
  position: relative;
  width: 80px;
  height: 60px;
  background: #ffa000;
  margin: auto;
  -ms-transform: translateY(60px);
  -webkit-transform: translateY(60px);
  transform: translateY(60px);
  border-radius: 8px;
  box-shadow: 0 0 2px #f57c00 inset;
}

.icon-lock:after {
  content: "";
  position: absolute;
  width: 50px;
  height: 35px;
  border: 9px solid #f57c00;
  border-bottom: none;
  bottom: 100%;
  left: 50%;
  -ms-transform: translateX(-50%);
  -webkit-transform: translateX(-50%);
  transform: translateX(-50%);
  border-top-left-radius: 50px;
  border-top-right-radius: 50px;
}

.icon-lock:before {
  content: "";
  position: absolute;
  width: 12px;
  height: 12px;
  background-color: #efefef;
  left: 50%;
  top: 20px;
  -ms-transform: translateX(-50%);
  -webkit-transform: translateX(-50%);
  transform: translateX(-50%);
  border-radius: 100%;
}

.el-input__code{
  color: #317ef3;
  cursor: pointer;

}
</style>
